<template>
	<view style="height: 100vh; background-color: #FFFFFF;">
		<u-navbar title-color="#FFFFFF" height="48" back-icon-color="#FFFFFF" :border-bottom="false" :is-fixed="true" :title="'通知反馈'"></u-navbar>
		<u-form :model="feedbackForm" ref="feedbackForm" label-width="100px" style="padding: 24rpx;">

			<u-form-item label-position="left" label="隐患名称" prop="name">
				<u-input type="text" :border="border" placeholder="请输入隐患名称" v-model="feedbackForm.name" />
			</u-form-item>
			
			<u-form-item label-position="left" label="隐患地点" prop="address">
				<u-input type="text" :border="border" placeholder="请输入详细的隐患 地点" v-model="feedbackForm.address" />
			</u-form-item>

			<u-form-item label-position="left" label="隐患描述" prop="remark">
			  <u-input type="text" :border="border" placeholder="请填写具体情况描述" v-model="feedbackForm.remark" />
			</u-form-item>
    </u-form>

		<u-button @click="submit" type="primary" style="margin: 24rpx;">提交</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				border: true,
				feedbackForm: {
					isEquipment: false
				},
				rules: {
					name: [{
						required: true,
						message: '请输入隐患名称',
						trigger: ['blur'],
					}],
					address: [{
						required: true,
						message: '请输入隐患详细地址',
						trigger: ['blur'],
					}],
					remark: [{
						required: true,
						message: '请输入隐患详细描述',
						trigger: ['blur'],
					}]
				}
			}
		},
		onLoad(e) {
			this.feedbackForm.ucId = e.ucId
		},
		methods: {
			submit() {
				this.$refs.feedbackForm.validate(valid => {
					if (valid) {
						this.utils.request("/api/app/inHiddenDanger/hiddenDangerFeedBack", this.feedbackForm, "post", "app", true).then(res => {
							uni.navigateBack({
								delta: 2
							})
						}).catch(error => {
							console.log(error)
							uni.navigateBack({
								delta: 2
							})
						})
					} else {
						console.log('验证失败');
					}
				});
			}
		},
		onReady() {
			this.$refs.feedbackForm.setRules(this.rules);
		},
	}
</script>

<style>

</style>
